package com.leoman.plz_p.adapter;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.leoman.plz_p.R;
import com.leoman.plz_p.module.bean.CourseBean;
import com.leoman.plz_p.weidget.RoundedTransformationBuilder;

import cn.com.corelib.utils.DisplayUtil;
import cn.com.corelib.utils.adapter.BaseAdapterHelper;
import cn.com.corelib.utils.adapter.normal.QuickAdapter;

/**
 * Created by guoh on 2018/8/26.
 */
public class QualityClassAdapter extends QuickAdapter<CourseBean>{
    public QualityClassAdapter(Context context) {
        super(context, R.layout.item_quality_class);
    }

    @Override
    protected void convert(BaseAdapterHelper helper, CourseBean item, int position) {
        Glide.with(context).load(item.getImage()).centerCrop().transform(new CenterCrop(context), new RoundedTransformationBuilder()
                .cornerRadius(DisplayUtil.dip2px(context, 5)).build(context)).into((ImageView) helper.getView(R.id.iv_image));
        helper.setText(R.id.tv_text,item.getName());
    }
}
